package model.ResultProperties;

import model.UrlFile;
import model.Interface.IresultProperties;
import android.graphics.Rect;

public class ShowPictureResultProperties implements IresultProperties{
	private UrlFile url;
	private int duration;
	private boolean isFlickering;
	private Rect location;
	private boolean isMoviePaused;
	public int numOfFrames;
	
	public ShowPictureResultProperties(UrlFile url, int duration,
			boolean isFlickering, Rect location,
			boolean isMoviePaused, int numOfFrames) {
		super();
		this.url = url;
		this.duration = duration;
		this.isFlickering = isFlickering;
		this.location = location;
		this.isMoviePaused = isMoviePaused;
		this.numOfFrames = numOfFrames;
	}

	public UrlFile getUrl() {
		return url;
	}

	public void setUrl(UrlFile url) {
		this.url = url;
	}
	
	public UrlFile getFrameUrl(int frameNum)
	{
		
		if (frameNum > 0 && numOfFrames > 1)
		{	
			String newFileUrl = url.getFileName().replace( Integer.valueOf(0).toString(),Integer.valueOf(frameNum).toString());
			String newUrl = url.getUrl().replace(url.getFileName(), newFileUrl);
			
			return new UrlFile(newUrl,newFileUrl,url.getFileSuffix());
		}
		else 
		{
			return url;
		}
	}

	public int getDuration() {
		if (duration < 1000)
			return 1000;
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
		if (duration < 1000)
			duration = 1000;
	}

	public boolean isFlickering() {
		return isFlickering;
	}

	public void setFlickering(boolean isFlickering) {
		this.isFlickering = isFlickering;
	}

	public Rect getLocation() {
		return location;
	}

	public void setLocation(Rect location) {
		this.location = location;
	}

	public boolean isMoviePaused() {
		return isMoviePaused;
	}

	public void setMoviePaused(boolean isMoviePaused) {
		this.isMoviePaused = isMoviePaused;
	}
	
	
	

}
